-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Multiple RequestMirrors Filters per HTTPRoute Rule #1819
Conversation
draft coding Signed-off-by: Ronnie Personal <[email protected]>
b6492d0
to
e7a1f39
Compare
@arkodg |
@@ -76,7 +76,7 @@ func (t *Translator) ProcessHTTPFilters(parentRef *RouteParentContext, | |||
RuleIdx: ruleIdx, | |||
HTTPFilterIR: &HTTPFilterIR{}, | |||
} | |||
|
|||
filterIdx := 0 | |||
for i := range filters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use i
Yes, I can use 'i' if I don't need to match the value with the index of Mirror list.
internal/gatewayapi/filters.go
Outdated
@@ -839,22 +842,26 @@ func (t *Translator) processRequestMirrorFilter( | |||
// Only add missing mirror destinations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this entire logic of adding missing mirror destinations can be removed, and so you can simplify this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this entire logic of adding missing mirror destinations can be removed, and so you can simplify this logic
Are we building filterContext.Mirror from scratch and there is no duplicate Endpoints?
I definitely can refactor the code based on your assessment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we dont need to consider the duplicate case, please go ahead and refactor
looks good @Ronnie-personal , added some comments, thanks for picking this one up |
Signed-off-by: Ronnie Personal <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1819 +/- ##
==========================================
- Coverage 66.14% 66.13% -0.02%
==========================================
Files 86 86
Lines 12874 12868 -6
==========================================
- Hits 8516 8510 -6
Misses 3830 3830
Partials 528 528
|
Signed-off-by: Ronnie Personal <[email protected]>
/retest |
1 similar comment
/retest |
Can anyone help me to understand this pipeline error at https://github.com/envoyproxy/gateway/actions/runs/5971186116/job/16224598674?pr=1819#step:6:140? I tested 'make -k lint' locally, I don't see the error. |
here is the error
|
Thank you! I will fix it. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
/retest |
What's happening with the pipeline? it only executed one check. |
Signed-off-by: Ronnie Personal <[email protected]>
Signed-off-by: Ronnie Personal <[email protected]>
/retest |
internal/ir/xds.go
Outdated
@@ -261,7 +261,7 @@ type HTTPRoute struct { | |||
// Redirections to be returned for this route. Takes precedence over Destinations. | |||
Redirect *Redirect `json:"redirect,omitempty" yaml:"redirect,omitempty"` | |||
// Destination that requests to this HTTPRoute will be mirrored to | |||
Mirror *RouteDestination `json:"mirror,omitempty" yaml:"mirror,omitempty"` | |||
Mirror []*RouteDestination `json:"mirrors,omitempty" yaml:"mirrors,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirror []*RouteDestination `json:"mirrors,omitempty" yaml:"mirrors,omitempty"` | |
Mirrors []*RouteDestination `json:"mirrors,omitempty" yaml:"mirrors,omitempty"` |
@@ -13,7 +13,10 @@ http: | |||
endpoints: | |||
- host: "1.2.3.4" | |||
port: 50000 | |||
mirror: | |||
name: "mirror-route-dest" | |||
mirrors: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep this example as is, and create one more test file for multiple-mirrors ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sound good, will do.
internal/gatewayapi/filters.go
Outdated
} | ||
filterContext.Mirror = append(filterContext.Mirror, newMirror) | ||
// Get the index of the last mirror added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need L842-L844, can't we just assign Endpoints
on L839 when creating RouteDestination
?
Signed-off-by: Ronnie-personal <[email protected]>
Signed-off-by: Ronnie-personal <[email protected]>
Signed-off-by: Ronnie-personal <[email protected]>
@Ronnie-personal can you remove following line, let's check with CI? |
…way into MultipleMirrors1811
Sorry, which line do you want to remove? |
should be gateway/test/conformance/conformance_test.go Lines 49 to 50 in 1f08e46
|
Thanks, I'm working on it right now. Do we also need to remove https://github.com/envoyproxy/gateway/blob/main/test/conformance/experimental_conformance_test.go#L96 |
Signed-off-by: Ronnie-personal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks !
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #1811